package com.aaa.service.sds.impl;

import com.aaa.entity.MyPage;
import com.aaa.entity.sds.TSdsRecord;
import com.aaa.entity.sds.TjMessage;
import com.aaa.entity.sds.Ttongji;
import com.aaa.service.sds.TSdsRecordService;
import com.aaa.dao.sds.TSdsRecordDao;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * (TSdsRecord)表服务实现类
 *
 * @author ZXJ
 * @since 2022-10-31 15:58:16
 */
@Service
public class TSdsRecordServiceImpl implements TSdsRecordService {
   @Autowired
   private TSdsRecordDao tSdsRecordDao;

   /**
    * 分页查询所有做题记录
    * @param myPage
    * @param tSdsRecord
    * @return
    */
   @Override
   public PageInfo queryAllRecord(MyPage myPage, TSdsRecord tSdsRecord) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      PageInfo pageInfo = new PageInfo(tSdsRecordDao.queryAllRecord());
      return pageInfo;
   }

   @Override
   public PageInfo getDetailMsg(MyPage myPage, Integer id) {
     PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      List<Map<String, Object>> queryxiangqing = tSdsRecordDao.queryxiangqing(id);
       System.out.println("queryxiangqing = " + queryxiangqing);
      PageInfo pageInfo = new PageInfo(queryxiangqing);
      return pageInfo;
   }

    @Override
    public int insertRecord(TSdsRecord tSdsRecord) {
       tSdsRecord.setCreatetime(new Date());
        int insert = tSdsRecordDao.insert(tSdsRecord);
        System.out.println(""+tSdsRecord.getId());
        return tSdsRecord.getId();
    }

    @Override
    public TSdsRecord checkrecord(TSdsRecord tSdsRecord) {
        TSdsRecord tSdsRecord1 = tSdsRecordDao.selectOne(tSdsRecord);
        return tSdsRecord1;
    }

    @Override
    public List<Ttongji> getTjData() {

        return tSdsRecordDao.getTjData();
    }

    @Override
    public PageInfo getTjData2(MyPage myPage, TjMessage tjMessage) {
        PageHelper.startPage(myPage.getPage(),myPage.getLimit());
        return new PageInfo(tSdsRecordDao.getTjData2(tjMessage));
    }
}

